package com.qf.controller;

import com.qf.common.dto.LogisticsDto;
import com.qf.service.LogisticsService;
import com.qf.vo.ResponseResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author KING
 * @ClassName: com.qf.controller.LogisticsController
 * @Description: 该类的功能描述
 * @date: 2021/10/30 9:43
 */
@RestController
@RequestMapping("/Logistics")
public class LogisticsController {
    @Resource
    private LogisticsService logisticsService;

    /**
     * 批量发货    数组形式传输过来，订单号唯一，数据库限制
     [{
     "orderNo": "2222222222222222",
     "productCount": 2,
     "sendCount": 2,
     "sendCompany": "韵达",
     "sendNo": "Y3423388423"
     }]
     * @param logisticsVoList
     * @return
     */
    @PostMapping("/add")
    public ResponseResult<Boolean> addBatch(@RequestBody List<LogisticsDto> logisticsVoList) {
        Boolean batch = logisticsService.addBatch(logisticsVoList);
        return ResponseResult.success(batch);
    }
}
